home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
percnt.zip
/
CTRLINIT.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1991-11-10
|
2KB
|
78 lines
{***************************************************************************
NoMan Custom Control Library $Version$
Initialization Code Unit
$Author$ $Date$
Copyright 1991 Anthony M. Vitabile
Unit Description
This Turbo Pascal for Windows unit contains the code used to
implement the initialization code for a library implementing a
new kind of control window for use in dialog boxes. The code
in this module defines the initialization code for the library.
The library uses straight Windows calls and does NOT use Object-
Windows. This is to allow the control to be used by ANY Windows
program.
This code is adapted from the code that appeared in the July,
1990 issue of Microsoft Systems Journal article, "Extending the
Windows 3.0 Interface with Installable Custom Controls" by Kevin
P. Welch. The code has been customized for use with Resource
Workshop.
***************************************************************************}
{$C Preload Discardable}
Unit CtrlInit;
Interface
procedure CtrlLibInit;
procedure LibExit;
Implementation
Uses CtrlCommonDefs, WndFnPercentCtrl, WinTypes, WinProcs;
var
SaveExit: Pointer;
procedure CtrlLibInit;
var
OK: boolean;
WC: TWndClass;
begin { CtrlLibInit }
{ Register Percent Control Class first }
WC.style := Pct_ClassStyle;
WC.lpfnWndProc := @PercentCtrlWndFn;
WC.cbClsExtra := Pct_ClassExtra;
WC.cbWndExtra := Pct_WndExtra;
WC.hInstance := HInstance;
WC.hIcon := 0;
WC.hCursor := 0;
WC.hbrBackground := 0;
WC.lpszMenuName := nil;
WC.lpszClassName := Pct_Name;
OK := RegisterClass(WC);
if not OK
then ExitCode := 0 { Cause the DLL to unload itself! }
else { Install our exit handler }
begin
SaveExit := ExitProc; { Save old exit procedure pointer }
ExitProc := @LibExit { Install LibExit exit procedure }
end
end { PercentCtrlInit };
{$S-}
procedure LibExit;
begin { LibExit }
UnregisterClass(Pct_Name, HInstance);
ExitProc := SaveExit
end { LibExit };
end.